<?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Menu
 *
 * @author aneto
 */
class NavigationAdminMenu extends NavigationDefaultMenu{
    //put your code here


	protected function initElements(){
		$q = Doctrine_Query::create()
			->from('Structure s')
			->select('s.*,ss.*,spg.* , pg.*, pgt.*')
			->where('s.isHidden = ? AND s.level > 1 AND s.lang = ? AND s.parameter = ?', array(false,$this->getAbbr(), 'memberzone'))
			->innerJoin('s.Structure ss ON ss.level > s.level AND s.lft < ss.lft AND s.rgt > ss.rgt')
			->leftJoin('ss.StructureProductGroup spg')
			->leftJoin('spg.ProductGroup pg WITH pg.level = 1')
			->leftJoin('pg.Translation pgt WITH pgt.lang = ?  ', $this->getCulture())
			->orderBy('s.lft, ss.lft')
			->setHydrationMode(Doctrine::HYDRATE_ARRAY_HIERARCHY);

		$result = $q->execute();
		$result[0]['__children'] = $result[0]['Structure'];

		foreach($result as $index => $elem){ // there is always Structure nodes on the top
			$this->elements[$index] = MenuElement::getInstance($elem, MenuElement::STRUCTURE_NODE, $this, null);
		}



	}
}